def check_if_prime(number):
    if number < 2:
        return False
    for i in range(2, int(number**0.5) + 1):
        if number % i == 0:
            return False
    return True

def find_next_prime(number):
    while True:
        number += 1
        if check_if_prime(number):
            return number

input_words = input().split()
number_string = ""
for word in input_words:
    if word == "zero":
        number_string += "0"
    elif word == "one":
        number_string += "1"
    elif word == "two":
        number_string += "2"
    elif word == "three":
        number_string += "3"
    elif word == "four":
        number_string += "4"
    elif word == "five":
        number_string += "5"
    elif word == "six":
        number_string += "6"
    elif word == "seven":
        number_string += "7"
    elif word == "eight":
        number_string += "8"
    elif word == "nine":
        number_string += "9"
    elif word in ['1', '2', '3', '4', '5', '6', '7', '8', '9']:
        print('Wrong input')

number = int(number_string)

next_prime_number = find_next_prime(number)

print(next_prime_number)
